<%--
  Created by IntelliJ IDEA.
  User: zhang
  Date: 2020-11-04
  Time: 15:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%String path = request.getContextPath();%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>跟踪信息</title>
    <%--<link rel="shortcut icon" href="/favicon.ico">--%>
    <link href="<%=path%>/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="<%=path%>/static/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="<%=path%>/static/css/animate.css" rel="stylesheet">
    <link href="<%=path%>/static/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="<%=path%>/static/layui/css/layui.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <%--<div class="ibox-title">
                           <button id="add" class="layui-btn-sm layui-btn layui-btn-radius btnys btnupdate" style="background-color: #1C84C6;color: white;"><i class="layui-icon">&#xe608;</i>添加</button>
                            <button class="layui-btn layui-btn-sm" id="btn-expand" style="background-color: #FF5823;color: white;">删除</button>
                        </div>--%>
                        <div class="ibox-content">
                            <div class="row">
                                <div class="col-sm-5 m-b-xs">
                                </div>
                                <div class="col-sm-4 m-b-xs">
                                </div>
                                <div class="col-sm-3">
                                </div>
                            </div>
                            <div class="table-responsive" id="supplierList">
                                <table class="table table-striped">
                                    <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>供应商名称</th>
                                        <th>地址</th>
                                        <th>成为供应商时间</th>
                                        <th>授信状态</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody id="tbody">
                                    <c:forEach items="${requestScope.pageInfo.list}" var="supplierInfo">
                                        <tr>
                                            <td>${supplierInfo.id}</td>
                                            <td>${supplierInfo.name}</td>
                                            <td>${supplierInfo.address}</td>
                                            <td><fmt:formatDate value="${supplierInfo.finishTime}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                                            <td>
                                                    <c:if test="${supplierInfo.creditState eq 1}">
                                                        <span style="color: green">已授信</span>
                                                    </c:if>
                                                    <c:if test="${supplierInfo.creditState eq 0}">
                                                        <span style="color: orange">未授信</span>
                                                    </c:if>
                                                    <c:if test="${supplierInfo.creditState eq 2}">
                                                        <span style="color: red">拒绝授信</span>
                                                    </c:if>
                                            </td>
                                            <td>
                                                <%--<button type="button" class="btn btn-primary btn-xs btn-danger">暂停</button>--%>
                                                <button type="button" class="btn btn-primary btn-xs detail" cid="${supplierInfo.id}">公司详情</button>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                                <%--<div id="pager" style="text-align:center">--%>
                                <%--<p>当前 <span>${pageInfo.pageNum}</span> 页,总 <span>${pageInfo.pages}</span> 页,共 <span>${pageInfo.total}</span> 条记录</p>--%>
                                <div style="text-align: center">
                                <c:forEach begin="1" end="${requestScope.pageInfo.pages}" var="i">
                                    <c:if test="${requestScope.pageInfo.pageNum eq i}" var="curP">
                                        <b style="color: red">[${i}]</b>
                                    </c:if>
                                    <c:if test="${not curP}">
                                        <a href="<%=path%>/supplier/tracking?pageNum=${i}">[${i}]</a>
                                    </c:if>
                                </c:forEach>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>



        <!-- 全局js -->
        <script src="<%=path%>/static/js/jquery.min.js?v=2.1.4"></script>
        <script src="<%=path%>/static/js/bootstrap.min.js?v=3.3.6"></script>
        <script src="<%=path%>/static/js/plugins/layer/layer.min.js"></script>

        <!-- 自定义js -->
        <script src="<%=path%>/static/js/content.js"></script>
        <script src="<%=path%>/static/js/demo/sparkline-demo.js"></script>

        <!-- 欢迎信息 -->
        <script src="<%=path%>/static/js/welcome.js"></script>
        <!-- --------->
        <script src="<%=path%>/static/js/jquery.min.js?v=2.1.4"></script>
        <script src="<%=path%>/static/js/bootstrap.min.js?v=3.3.6"></script>



        <!-- Flot -->
        <script src="<%=path%>/static/js/plugins/flot/jquery.flot.js"></script>
        <script src="<%=path%>/static/js/plugins/flot/jquery.flot.tooltip.min.js"></script>
        <script src="<%=path%>/static/js/plugins/flot/jquery.flot.spline.js"></script>
        <script src="<%=path%>/static/js/plugins/flot/jquery.flot.resize.js"></script>
        <script src="<%=path%>/static/js/plugins/flot/jquery.flot.pie.js"></script>

        <!-- Peity -->
        <script src="<%=path%>/static/js/plugins/peity/jquery.peity.min.js"></script>
        <script src="<%=path%>/static/js/demo/peity-demo.js"></script>

        <!-- 自定义js -->
        <script src="<%=path%>/static/js/content.js?v=1.0.0"></script>


        <!-- jQuery UI -->
        <script src="<%=path%>/static/js/plugins/jquery-ui/jquery-ui.min.js"></script>

        <!-- GITTER -->
        <script src="<%=path%>/static/js/plugins/gritter/jquery.gritter.min.js"></script>

        <!-- EayPIE -->
        <script src="<%=path%>/static/js/plugins/easypiechart/jquery.easypiechart.js"></script>

        <!-- Sparkline -->
        <script src="<%=path%>/static/js/plugins/sparkline/jquery.sparkline.min.js"></script>

        <!-- Sparkline demo data  -->
        <script src="<%=path%>/static/js/demo/sparkline-demo.js"></script>

        <script src="<%=path%>/static/js/demo/sparkline-demo.js"></script>
        <script src="<%=path%>/static/layui/layui.all.js"></script>

        <script src="<%=path%>/static/myjs/MyLayer.js"></script>
        <script>

            /*$(function () {
                GetList();
            })

            //从服务器端通过ajax获取供应商信息
            function GetList() {
                $.ajax({
                    url: '<%=path%>/supplier/tracking',
                    type: 'post',
                    dataType: 'json',
                    success: function (data) {
                        console.log(data);
                        //用于分页展示的测试数据，一般通过服务端得到
                        layui.use(['laypage', 'layer'], function () {
                            var laypage = layui.laypage, layer = layui.layer;
                            //调用分页
                            laypage.render({
                                elem: 'pager'
                                // 1.elem: 'id' 注意：这里不能加 # 号,2. elem: document.getElementById('id')
                                , count: data.length  //数据总数。一般通过服务端得到            //
                                , limit: 5         //每页显示的条数。laypage将会借助 count 和 limit 计算出分页
                                , layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
                                , first: '首页'
                                , last: '末页'
                                , jump: function (obj) {
                                    //模拟渲染
                                    document.getElementById('tbody').innerHTML = function () {
                                        var arr = []
                                            , thisData = data.concat().splice(obj.curr * obj.limit - obj.limit, obj.limit);
                                        layui.each(thisData, function (index, item) {
                                            arr.push('<tr><td>' + this.name + '</td><td>' + this.address + '</td><td>' + this.CName);
                                        });
                                        return arr.join('');
                                    }();
                                }
                            });
                        });
                    }
                })
            }*/

            $(function () {
                $(".detail").click(function () {
                    var cid = $(this).attr("cid");
                    alert(cid);
                    MyLayer.iframeLayer(layer,'添加用户',"<%=path%>/system/addUser");
                })
            });
        </script>
</body>

</html>
